/*
    关于这个运行报错cannot find jsdom module ， 如果在全局安装之后任然报错 ， 那么可以进入项目目录， 然后在项目中安装
*/
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const fs = require("fs");
const path = require("path");
let filepath = path.join(__dirname , process.argv[2]);
fs.readFile(filepath , (err , data) => {
    const dom = new JSDOM(data.toString());
    let div = dom.window.document.querySelector(".con");
    let context = div.textContent;
    let p = dom.window.document.createElement("p");
    p.className = "list";
    p.innerHTML = context;
    dom.window.document.body.replaceChild(p , div);
    console.log(dom.serialize());
});
